package com.boxuegu.domain;

import java.util.Objects;

public class Card {
    /**
     * 地铁卡用户信息类
     */
        private String userName;//用户姓名
        private String userId;//地铁卡号
        private double cardBalance;//地铁卡余额

        public Card() {
        }

        public Card(String userName, String userId, double cardBalance) {
            this.userName = userName;
            this.userId = userId;
            this.cardBalance = cardBalance;
        }

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public double getCardBalance() {
            return cardBalance;
        }

        public void setCardBalance(double cardBalance) {
            this.cardBalance = cardBalance;
        }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Card card = (Card) o;
        return Double.compare(card.cardBalance, cardBalance) == 0 &&
                Objects.equals(userName, card.userName) &&
                Objects.equals(userId, card.userId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userName, userId, cardBalance);
    }

    @Override
        public String toString() {
            return "地铁卡用户信息:\t" + "姓名:" + userName + "\t地铁卡号:" + userId + "\t卡内余额:" + cardBalance;
        }
    }

